import request from '../request';
let api = {
  menuList: "/api/home/category/tree-all", //商品品分类列表
  menuInfo: "/api/home/category/tree-info", //分类详情
  productList: "/api/home/product/list", //获取商品列表
  productInfo: "/api/home/product/info", //获取商品详情
  commentList: "/api/home/product/product-comment-list", //获取商品评价列表

  cartList: "/api/home/cart/list", //获取购物车列表
  addCart: "/api/home/cart/add", //商品添加到购物车
  changeProduct: "/api/home/cart/save", //修改购物车商品属性
  proCollection: "/api/home/product/collection", //收藏商品
  collectionUp: "/api/home/product/is-collection-up" //确认商品是否已收藏
}
export default {
  //获取商品分类列表
  menuList(params = {}) {
    return request.get(api.menuList, {
      params
    });
  },
  //获取商品分类信息
  menuInfo(params = {}) {
    return request.get(api.menuInfo, {
      params
    });
  },
  //获取商品列表
  productList(params = {}) {
    return request.get(api.productList, {
      params
    });
  },
  //获取商品详情
  productInfo(params = {}) {
    return request.get(api.productInfo, {
      params
    });
  },
  //获取购物车列表
  cartList(params = {}) {
    return request.get(api.cartList, {
      params
    });
  },
  //商品添加到购物车
  addCart(params = {}) {
    return request.post(api.addCart,
      params
    );
  },
  //修改购物车商品属性
  changeProduct(params = {}) {
    return request.post(api.changeProduct,
      params
    );
  },
  //收藏商品
  proCollection(params = {}) {
    return request.post(api.proCollection,
      params
    );
  },
  //商品是否已经收藏
  collectionUp(params = {}) {
    return request.get(api.collectionUp, {
      params
    });
  },
  //商品评价列表
  commentList(params = {}) {
    return request.get(api.commentList, {
      params
    });
  },
}
